fn main() {
    let triple = (0, -2, 3);
    // TODO ^ try different values for triple

    println!("Tell me about {:?}", triple);
    // Match can be used to destructure a tuple
    match triple {
        (0, y, z) => println!("first is `0`, `y` is {:?}, and `z` is {:?}", y, z),
        // if we cancel the comment of the following line, there will be an compilation error:
        // mismatched types  expected a tuple with 3 elements, found one with 4 elements
        // (0, y, z, _) => println!("first is `0`, `y` is {:?}, and `z` is {:?}", y, z),
        (1, ..) => println!("first is `1` and the rest doesn't matter"),
        (.., 2) => println!("last is `2` and the rest doesn't matter"),
        // we can know match isnot the same as switch in C
        // cause if we cancel the comment of the following line, theoretically the triple can match (0, y, z) and (..,3), but
        // only (0, y, z) branch will match
        // (.., 3) => println!("last is `2` and the rest doesn't matter"),
        (3, .., 4) => println!("first is `3`, last is `4` and the rest doesn't matter"),
        // `..` can be used to ignore the rest of the tuple
        _ => println!("It doesn't matter what they are"),
        // `_` means don't bind the value to a variable
    }
}